/**══════════════════════════════════╗
*作    者：songbaobao                                                 ║
*职    业：我以我血荐轩辕                                              ║                                              
*CSND地址：https://blog.csdn.net/weixin_43949535                       ║
**GitHub ：https://github.com/TsinghuaLucky912/My_own_C-_study_and_blog║
*═══════════════════════════════════╣
*创建时间：                                                           
*功能描述：                                                            
*                                                                      
*                                                                      
*═══════════════════════════════════╣
*结束时间:                                                           
*═══════════════════════════════════╝
//                .-~~~~~~~~~-._       _.-~~~~~~~~~-.
//            __.'              ~.   .~              `.__
//          .'//              西南\./联大               \\`.
//        .'//                     |                     \\`.
//      .'// .-~"""""""~~~~-._     |     _,-~~~~"""""""~-. \\`.
//    .'//.-"                 `-.  |  .-'                 "-.\\`.
//  .'//______.============-..   \ | /   ..-============.______\\`.
//.'______________________________\|/______________________________`.
*/
#include <iostream>
#include <vector>
#include <string>
#include <unordered_map>
#include <ctype.h>
#include <queue>
#include <list>
#include <map>
#include <math.h>
#include <algorithm>
#include <iomanip>
using namespace std;


int main()
{
#if A
	int a, b;
	while (EOF != scanf("%d%d", &a, &b))
		printf("%d\n", a + b);
#endif

#if B
	int a, b, N;
	cin >> N;
	while (N--)
	{
		scanf("%d%d", &a, &b);
		printf("%d\n", a + b);
	}
#endif
	
#if C
	int a, b;
	while (scanf("%d%d", &a, &b), a || b)
		printf("%d\n", a + b);
#endif

#if D
	int a, N;
	cin >> N;
	while (N != 0)
	{
		int sum = 0;
		while (N--)
		{
			cin >> a;
			sum += a;
			if (N == 0)
				printf("%d\n", sum);
		}
		cin >> N;
	}
#endif

#if E
	int a, N, M;
	cin >> N;
	while (N--)
	{
		cin >> M;
		int sum = 0;
		while (M--)
		{
			cin >> a;
			sum += a;
			if (M == 0)
				printf("%d\n", sum);
		}
	}
#endif

#if F
	int N, a;
	while (EOF != scanf("%d", &N))
	{
		int sum = 0;
		while (N--)
		{
			cin >> a;
			sum += a;
			if (N == 0)
				printf("%d\n", sum);
		}
	}
#endif

#if G
	int a, b;
	while (EOF != scanf("%d%d", &a, &b))
		printf("%d\n\n", a + b);
#endif


	int a, N, M;
	cin >> N;
	while (N--)
	{
		cin >> M;
		int sum = 0;
		while (M--)
		{
			cin >> a;
			sum += a;
			if (M == 0)
				printf("%d\n\n", sum);
		}
	}

	return 0;
}
/**
*备用注释：
*
*
*
*/